home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / os2 / adaptor.zip / ADAPT.ZIP / adaptor / src / dalib.c < prev    next >
Text File  |  1994-01-03  |  20KB  |  888 lines

  1. # include "Dalib.h"
  2. # include "yyDalib.w"
  3. # include <stdio.h>
  4. # if defined __STDC__ | defined __cplusplus
  5. #  include <stdlib.h>
  6. # else
  7.    extern void exit ();
  8. # endif
  9. # include "Tree.h"
  10. # include "Definiti.h"
  11.  
  12. # ifndef NULL
  13. # define NULL 0L
  14. # endif
  15. # ifndef false
  16. # define false 0
  17. # endif
  18. # ifndef true
  19. # define true 1
  20. # endif
  21.  
  22. # ifdef yyInline
  23. # define yyALLOC(tree, free, max, alloc, nodesize, make, ptr, kind) \
  24.   if ((ptr = (tree) free) >= (tree) max) ptr = alloc (); \
  25.   free += nodesize [kind]; \
  26.   ptr->yyHead.yyMark = 0; \
  27.   ptr->Kind = kind;
  28. # else
  29. # define yyALLOC(tree, free, max, alloc, nodesize, make, ptr, kind) ptr = make (kind);
  30. # endif
  31.  
  32. # define yyWrite(s) (void) fputs (s, yyf)
  33. # define yyWriteNl (void) fputc ('\n', yyf)
  34.  
  35. # line 67 "Dalib.puma"
  36.  
  37.  
  38. # include <stdio.h>
  39. # include "Idents.h"
  40. # include "StringMe.h"
  41.  
  42. # include "Expressi.h"   /* MakeSliceExp */
  43. # include "Types.h"         /* ArrayFormals */
  44. # include "Transfor.h"     /* ExpToVarParam */
  45.  
  46.  
  47.  
  48. static FILE * yyf = stdout;
  49.  
  50. static void yyAbort
  51. # ifdef __cplusplus
  52.  (char * yyFunction)
  53. # else
  54.  (yyFunction) char * yyFunction;
  55. # endif
  56. {
  57.  (void) fprintf (stderr, "Error: module Dalib, routine %s failed\n", yyFunction);
  58.  exit (1);
  59. }
  60.  
  61. tIdent MakeDalibId ARGS((String name));
  62. tIdent MakeDalibId1 ARGS((String name, int n));
  63. tTree MakeVarDeclA ARGS((tIdent id, String n, tTree val));
  64. tTree MakeUsedVarA ARGS((tIdent id, String n));
  65. tTree MakeVarParamDeclA ARGS((tIdent id, String n));
  66. tTree FirstArrayElement ARGS((tTree t));
  67. tTree MakeSizeExp ARGS((tTree t));
  68. tTree MakeElemsExp ARGS((tTree t));
  69. static tTree MakeIndexSizeExp ARGS((tTree t));
  70. tTree DoSingleNode ARGS((tTree stmt));
  71. tTree MaskNodeStmt ARGS((tTree stmt, tTree var));
  72. static tTree MakeMask ARGS((tTree var));
  73. tTree DalibLastFormalParam ARGS((tTree t, tTree params));
  74. tTree DalibLastActualParam ARGS((tTree t, tTree params));
  75. tTree DalibTreeSizeParam ARGS((tTree t, tTree params));
  76. tTree DalibRangeParams ARGS((tTree t, tTree params));
  77. static tTree DalibRangeParamsFA ARGS((tTree formals, tTree actuals, tTree params));
  78. static tTree DalibRangeParamsA ARGS((tTree actual, tTree params));
  79. static tTree DalibRangeParamsF ARGS((tTree formal, tTree params));
  80. tTree DalibFormalSize ARGS((tTree t, tTree params));
  81. tTree DalibLocalSize ARGS((tTree t, tTree params));
  82. static tTree DalibLocalSizeExp ARGS((tIdent name, tTree t, int dist));
  83.  
  84. tIdent MakeDalibId
  85. # if defined __STDC__ | defined __cplusplus
  86. (String name)
  87. # else
  88. (name)
  89.  String name;
  90. # endif
  91. {
  92. # line 88 "Dalib.puma"
  93.  
  94. char s [100];
  95.  
  96. # line 92 "Dalib.puma"
  97.   {
  98. # line 93 "Dalib.puma"
  99.  if (target_machine == SUPRENUM)
  100.        sprintf (s, "_dalib_%s", name);
  101.     else if (target_machine == RIOS_PVM)
  102.        sprintf (s, "dalib_%s_", name);
  103.      else
  104.        sprintf (s, "dalib_%s", name);
  105.  
  106.   }
  107.    return MakeIdent (s, strlen (s));
  108.  
  109. }
  110.  
  111. tIdent MakeDalibId1
  112. # if defined __STDC__ | defined __cplusplus
  113. (String name, register int n)
  114. # else
  115. (name, n)
  116.  String name;
  117.  register int n;
  118. # endif
  119. {
  120. # line 105 "Dalib.puma"
  121.  
  122. char s [100];
  123.  
  124. # line 109 "Dalib.puma"
  125.   {
  126. # line 110 "Dalib.puma"
  127.  if (target_machine == SUPRENUM)
  128.        sprintf (s, "_dalib_%s%d", name, n);
  129.     else if (target_machine == RIOS_PVM)
  130.        sprintf (s, "dalib_%s%d_", name, n);
  131.      else
  132.        sprintf (s, "dalib_%s%d", name, n);
  133.  
  134.   }
  135.    return MakeIdent (s, strlen (s));
  136.  
  137. }
  138.  
  139. tTree MakeVarDeclA
  140. # if defined __STDC__ | defined __cplusplus
  141. (register tIdent id, String n, register tTree val)
  142. # else
  143. (id, n, val)
  144.  register tIdent id;
  145.  String n;
  146.  register tTree val;
  147. # endif
  148. {
  149. # line 130 "Dalib.puma"
  150.  
  151. char hstring[250];
  152. tIdent hid;
  153.  
  154. # line 135 "Dalib.puma"
  155.   {
  156. # line 136 "Dalib.puma"
  157.  GetString (id, hstring);
  158.      strcat (hstring, n);
  159.      hid = MakeIdent (hstring, strlen (hstring));
  160.  
  161.   }
  162.    return (mVAR_DECL (hid, 0, val));
  163.  
  164. }
  165.  
  166. tTree MakeUsedVarA
  167. # if defined __STDC__ | defined __cplusplus
  168. (register tIdent id, String n)
  169. # else
  170. (id, n)
  171.  register tIdent id;
  172.  String n;
  173. # endif
  174. {
  175. # line 153 "Dalib.puma"
  176.  
  177. char hstring[250];
  178. tIdent hid;
  179.  
  180. # line 158 "Dalib.puma"
  181.   {
  182. # line 159 "Dalib.puma"
  183.  GetString (id, hstring);
  184.      strcat (hstring, n);
  185.      hid = MakeIdent (hstring, strlen (hstring));
  186.  
  187.   }
  188.    return (mUSED_VAR (mVAR_OBJ (0, hid)));
  189.  
  190. }
  191.  
  192. tTree MakeVarParamDeclA
  193. # if defined __STDC__ | defined __cplusplus
  194. (register tIdent id, String n)
  195. # else
  196. (id, n)
  197.  register tIdent id;
  198.  String n;
  199. # endif
  200. {
  201. # line 176 "Dalib.puma"
  202.  
  203. char hstring[250];
  204. tIdent hid;
  205.  
  206. # line 181 "Dalib.puma"
  207.   {
  208. # line 182 "Dalib.puma"
  209.  GetString (id, hstring);
  210.      strcat (hstring, n);
  211.      hid = MakeIdent (hstring, strlen (hstring));
  212.  
  213.   }
  214.    return (mVAR_PARAM_DECL (hid, 0, mDUMMY_TYPE ()));
  215.  
  216. }
  217.  
  218. tTree FirstArrayElement
  219. # if defined __STDC__ | defined __cplusplus
  220. (register tTree t)
  221. # else
  222. (t)
  223.  register tTree t;
  224. # endif
  225. {
  226.   if (t->Kind == kUSED_VAR) {
  227. # line 199 "Dalib.puma"
  228.    return t;
  229.  
  230.   }
  231.   if (t->Kind == kINDEXED_VAR) {
  232. # line 203 "Dalib.puma"
  233.    return mINDEXED_VAR (t->INDEXED_VAR.IND_VAR, FirstArrayElement (t->INDEXED_VAR.IND_EXPS));
  234.  
  235.   }
  236.   if (t->Kind == kBTE_LIST) {
  237.   if (t->BTE_LIST.Elem->Kind == kSLICE_EXP) {
  238. # line 207 "Dalib.puma"
  239.    return mBTE_LIST (t->BTE_LIST.Elem->SLICE_EXP.START, FirstArrayElement (t->BTE_LIST.Next));
  240.  
  241.   }
  242. # line 211 "Dalib.puma"
  243.    return mBTE_LIST (t->BTE_LIST.Elem, FirstArrayElement (t->BTE_LIST.Next));
  244.  
  245.   }
  246.   if (t->Kind == kBTE_EMPTY) {
  247. # line 215 "Dalib.puma"
  248.    return t;
  249.  
  250.   }
  251. # line 219 "Dalib.puma"
  252.   {
  253. # line 220 "Dalib.puma"
  254.    printf ("Illegal Call of FirstArrayElement\n");
  255. # line 221 "Dalib.puma"
  256.    FileUnparse (stdout, t);
  257. # line 222 "Dalib.puma"
  258.    WriteTree (stdout, t);
  259. # line 223 "Dalib.puma"
  260.    kill_in_protocol ();
  261.   }
  262.    return NoTree;
  263.  
  264. }
  265.  
  266. tTree MakeSizeExp
  267. # if defined __STDC__ | defined __cplusplus
  268. (register tTree t)
  269. # else
  270. (t)
  271.  register tTree t;
  272. # endif
  273. {
  274. # line 243 "Dalib.puma"
  275.  
  276. tTree size_exp, index_exp;
  277.  
  278.   if (t->Kind == kUSED_VAR) {
  279. # line 247 "Dalib.puma"
  280.    return MakeConstant (TreeSize (t));
  281.  
  282.   }
  283.   if (t->Kind == kINDEXED_VAR) {
  284.   if (t->INDEXED_VAR.IND_VAR->Kind == kUSED_VAR) {
  285. # line 251 "Dalib.puma"
  286.   {
  287. # line 252 "Dalib.puma"
  288.  size_exp = MakeConstant (TreeSize (t));
  289.      index_exp = MakeIndexSizeExp (t->INDEXED_VAR.IND_EXPS);
  290.      if (index_exp != NoTree)
  291.        size_exp = mOP_EXP (mOP_TIMES (), index_exp, size_exp);
  292.  
  293.   }
  294.    return size_exp;
  295.  
  296.   }
  297.   }
  298. # line 260 "Dalib.puma"
  299.   {
  300. # line 261 "Dalib.puma"
  301.    failure_protocol ("Dalib", "MakeSizeExp", t);
  302.   }
  303.    return NoTree;
  304.  
  305. }
  306.  
  307. tTree MakeElemsExp
  308. # if defined __STDC__ | defined __cplusplus
  309. (register tTree t)
  310. # else
  311. (t)
  312.  register tTree t;
  313. # endif
  314. {
  315. # line 267 "Dalib.puma"
  316.  
  317. tTree index_exp;
  318.  
  319.   if (t->Kind == kUSED_VAR) {
  320. # line 271 "Dalib.puma"
  321.    return MakeConstant (1);
  322.  
  323.   }
  324.   if (t->Kind == kINDEXED_VAR) {
  325.   if (t->INDEXED_VAR.IND_VAR->Kind == kUSED_VAR) {
  326. # line 275 "Dalib.puma"
  327.   {
  328. # line 276 "Dalib.puma"
  329.  index_exp = MakeIndexSizeExp (t->INDEXED_VAR.IND_EXPS);
  330.      if (index_exp == NoTree)
  331.        index_exp = MakeConstant(1);
  332.  
  333.   }
  334.    return index_exp;
  335.  
  336.   }
  337.   }
  338. # line 283 "Dalib.puma"
  339.   {
  340. # line 284 "Dalib.puma"
  341.    failure_protocol ("Dalib", "MakeElemsExp", t);
  342.   }
  343.    return NoTree;
  344.  
  345. }
  346.  
  347. static tTree MakeIndexSizeExp
  348. # if defined __STDC__ | defined __cplusplus
  349. (register tTree t)
  350. # else
  351. (t)
  352.  register tTree t;
  353. # endif
  354. {
  355. # line 290 "Dalib.puma"
  356.  
  357. tTree size_exp, index_exp;
  358.  
  359.   if (t->Kind == kBTE_LIST) {
  360.   if (t->BTE_LIST.Elem->Kind == kSLICE_EXP) {
  361. # line 294 "Dalib.puma"
  362.   {
  363. # line 298 "Dalib.puma"
  364.  index_exp = MakeIndexSizeExp (t->BTE_LIST.Next);
  365.      size_exp  = MakeSliceExp (t->BTE_LIST.Elem->SLICE_EXP.START, t->BTE_LIST.Elem->SLICE_EXP.STOP);
  366.      if (index_exp != NoTree)
  367.        size_exp = mOP_EXP (mOP_TIMES (), index_exp, size_exp);
  368.  
  369.   }
  370.    return size_exp;
  371.  
  372.   }
  373. # line 306 "Dalib.puma"
  374.    return MakeIndexSizeExp (t->BTE_LIST.Next);
  375.  
  376.   }
  377.   if (t->Kind == kBTE_EMPTY) {
  378. # line 310 "Dalib.puma"
  379.    return NoTree;
  380.  
  381.   }
  382. # line 314 "Dalib.puma"
  383.   {
  384. # line 315 "Dalib.puma"
  385.    failure_protocol ("Dalib", "MakeIndexSizeExp", t);
  386.   }
  387.    return NoTree;
  388.  
  389. }
  390.  
  391. tTree DoSingleNode
  392. # if defined __STDC__ | defined __cplusplus
  393. (register tTree stmt)
  394. # else
  395. (stmt)
  396.  register tTree stmt;
  397. # endif
  398. {
  399. # line 333 "Dalib.puma"
  400.   {
  401. # line 334 "Dalib.puma"
  402.    if (! (target_model == UNI_PROC)) goto yyL1;
  403.   }
  404.    return stmt;
  405. yyL1:;
  406.  
  407. # line 338 "Dalib.puma"
  408.   {
  409. # line 339 "Dalib.puma"
  410.    if (! (target_model == HOST_NODE)) goto yyL2;
  411.   {
  412. # line 340 "Dalib.puma"
  413.    if (! ((IsHost != 0))) goto yyL2;
  414.   }
  415.   }
  416.    return stmt;
  417. yyL2:;
  418.  
  419. # line 344 "Dalib.puma"
  420.   {
  421. # line 345 "Dalib.puma"
  422.    if (! (target_model == HOST_NODE)) goto yyL3;
  423.   {
  424. # line 346 "Dalib.puma"
  425.    if (! ((IsHost == 0))) goto yyL3;
  426.   }
  427.   }
  428.    return NoTree;
  429. yyL3:;
  430.  
  431. # line 350 "Dalib.puma"
  432.  {
  433.   tTree ht;
  434.   {
  435. # line 352 "Dalib.puma"
  436.  
  437. # line 353 "Dalib.puma"
  438.  ht = mPROC_OBJ (MakeDalibId ("pid"));
  439.     ht = mFUNC_CALL_EXP (ht, mBTP_EMPTY());
  440.     ht = mOP_EXP (mOP_EQ(), ht, mCONST_EXP (mINT_CONSTANT (1)));
  441.     ht = mACF_IF (ht, mACF_LIST (stmt, mACF_EMPTY()), mACF_EMPTY());
  442.  
  443.   }
  444.   {
  445.    return ht;
  446.   }
  447.  }
  448.  
  449. }
  450.  
  451. tTree MaskNodeStmt
  452. # if defined __STDC__ | defined __cplusplus
  453. (register tTree stmt, register tTree var)
  454. # else
  455. (stmt, var)
  456.  register tTree stmt;
  457.  register tTree var;
  458. # endif
  459. {
  460.   if (var->Kind == kINDEXED_VAR) {
  461. # line 374 "Dalib.puma"
  462.   {
  463. # line 375 "Dalib.puma"
  464.    if (! ((TreeDistribution (var->INDEXED_VAR.IND_VAR) != 1))) goto yyL1;
  465.   {
  466. # line 376 "Dalib.puma"
  467.    printf ("MaskNodeStmt, var is not distributed");
  468. # line 377 "Dalib.puma"
  469.    WriteTree (stdout, var);
  470. # line 378 "Dalib.puma"
  471.    kill_in_protocol ();
  472.   }
  473.   }
  474.    return NoTree;
  475. yyL1:;
  476.  
  477. # line 382 "Dalib.puma"
  478.   {
  479. # line 383 "Dalib.puma"
  480.    if (! ((TreeRank (LastIndex (var->INDEXED_VAR.IND_EXPS)) != 0))) goto yyL2;
  481.   {
  482. # line 384 "Dalib.puma"
  483.    printf ("MaskNodeStmt, var not for single node");
  484. # line 385 "Dalib.puma"
  485.    WriteTree (stdout, var);
  486. # line 386 "Dalib.puma"
  487.    kill_in_protocol ();
  488.   }
  489.   }
  490.    return NoTree;
  491. yyL2:;
  492.  
  493. # line 390 "Dalib.puma"
  494.    return mACF_IF (MakeMask (var), mACF_LIST (stmt, mACF_EMPTY ()), mACF_EMPTY ());
  495.  
  496.   }
  497. # line 395 "Dalib.puma"
  498.   {
  499. # line 396 "Dalib.puma"
  500.    printf ("MaskNodeStmt failed");
  501. # line 397 "Dalib.puma"
  502.    WriteTree (stdout, var);
  503. # line 398 "Dalib.puma"
  504.    kill_in_protocol ();
  505.   }
  506.    return NoTree;
  507.  
  508. }
  509.  
  510. static tTree MakeMask
  511. # if defined __STDC__ | defined __cplusplus
  512. (register tTree var)
  513. # else
  514. (var)
  515.  register tTree var;
  516. # endif
  517. {
  518.   if (var->Kind == kINDEXED_VAR) {
  519.   if (var->INDEXED_VAR.IND_VAR->Kind == kUSED_VAR) {
  520. # line 410 "Dalib.puma"
  521.  {
  522.   tTree func;
  523.   tTree params;
  524.   {
  525. # line 412 "Dalib.puma"
  526.  
  527. # line 413 "Dalib.puma"
  528.  
  529. # line 415 "Dalib.puma"
  530.  params = DalibLastActualParam (var, mBTP_EMPTY());
  531.      params = DalibLastFormalParam (var, params);
  532.      func   = mPROC_OBJ (MakeDalibId ("have_i"));
  533.      func   = mFUNC_CALL_EXP (func, params);
  534.  
  535.   }
  536.   {
  537.    return func;
  538.   }
  539.  }
  540.  
  541.   }
  542.   }
  543. # line 424 "Dalib.puma"
  544.   {
  545. # line 425 "Dalib.puma"
  546.    failure_protocol ("Dalib", "MakeMask", var);
  547.   }
  548.    return NoTree;
  549.  
  550. }
  551.  
  552. tTree DalibLastFormalParam
  553. # if defined __STDC__ | defined __cplusplus
  554. (register tTree t, register tTree params)
  555. # else
  556. (t, params)
  557.  register tTree t;
  558.  register tTree params;
  559. # endif
  560. {
  561.   if (t->Kind == kINDEXED_VAR) {
  562. # line 441 "Dalib.puma"
  563.    return DalibLastFormalParam (t->INDEXED_VAR.IND_VAR, params);
  564.  
  565.   }
  566.   if (t->Kind == kUSED_VAR) {
  567. # line 445 "Dalib.puma"
  568.    return DalibLastFormalParam (ArrayFormals (t->USED_VAR.VARNAME->VAR_OBJ.Object), params);
  569.  
  570.   }
  571.   if (t->Kind == kTYPE_LIST) {
  572. # line 449 "Dalib.puma"
  573.    return DalibLastFormalParam (LastIndex (t), params);
  574.  
  575.   }
  576.   if (t->Kind == kINDEX_TYPE) {
  577. # line 453 "Dalib.puma"
  578.    return mBTP_LIST (ExpToVarParam (MakeSliceExp (t->INDEX_TYPE.LOWER, t->INDEX_TYPE.UPPER)), params);
  579.  
  580.   }
  581.   if (t->Kind == kDYNAMIC) {
  582.   if (t->DYNAMIC.Shape->Kind == kSLICE_EXP) {
  583. # line 457 "Dalib.puma"
  584.    return mBTP_LIST (ExpToVarParam (MakeSliceExp (t->DYNAMIC.Shape->SLICE_EXP.START, t->DYNAMIC.Shape->SLICE_EXP.STOP)), params);
  585.  
  586.   }
  587.   }
  588. # line 461 "Dalib.puma"
  589.   {
  590. # line 462 "Dalib.puma"
  591.    failure_protocol ("Dalib", "DalibLastFormalParam", t);
  592.   }
  593.    return NoTree;
  594.  
  595. }
  596.  
  597. tTree DalibLastActualParam
  598. # if defined __STDC__ | defined __cplusplus
  599. (register tTree t, register tTree params)
  600. # else
  601. (t, params)
  602.  register tTree t;
  603.  register tTree params;
  604. # endif
  605. {
  606.   if (t->Kind == kINDEXED_VAR) {
  607. # line 478 "Dalib.puma"
  608.    return mBTP_LIST (ExpToVarParam (LastIndex (t->INDEXED_VAR.IND_EXPS)), params);
  609.  
  610.   }
  611. # line 482 "Dalib.puma"
  612.   {
  613. # line 483 "Dalib.puma"
  614.    failure_protocol ("Dalib", "DalibLastActualParam", t);
  615.   }
  616.    return NoTree;
  617.  
  618. }
  619.  
  620. tTree DalibTreeSizeParam
  621. # if defined __STDC__ | defined __cplusplus
  622. (register tTree t, register tTree params)
  623. # else
  624. (t, params)
  625.  register tTree t;
  626.  register tTree params;
  627. # endif
  628. {
  629.   if (t->Kind == kINDEXED_VAR) {
  630. # line 495 "Dalib.puma"
  631.    return DalibTreeSizeParam (t->INDEXED_VAR.IND_VAR, params);
  632.  
  633.   }
  634.   if (t->Kind == kUSED_VAR) {
  635. # line 499 "Dalib.puma"
  636.    return mBTP_LIST (ExpToVarParam (MakeConstant (TreeSize (t))), params);
  637.  
  638.   }
  639. # line 503 "Dalib.puma"
  640.   {
  641. # line 504 "Dalib.puma"
  642.    failure_protocol ("Dalib", "DalibTreeSizeParam", t);
  643.   }
  644.    return NoTree;
  645.  
  646. }
  647.  
  648. tTree DalibRangeParams
  649. # if defined __STDC__ | defined __cplusplus
  650. (register tTree t, register tTree params)
  651. # else
  652. (t, params)
  653.  register tTree t;
  654.  register tTree params;
  655. # endif
  656. {
  657.   if (t->Kind == kINDEXED_VAR) {
  658.   if (t->INDEXED_VAR.IND_VAR->Kind == kUSED_VAR) {
  659. # line 520 "Dalib.puma"
  660.  {
  661.   tTree new;
  662.   {
  663. # line 522 "Dalib.puma"
  664.  
  665. # line 524 "Dalib.puma"
  666.  new = DalibRangeParamsFA (ArrayFormals (t->INDEXED_VAR.IND_VAR->USED_VAR.VARNAME->VAR_OBJ.Object), t->INDEXED_VAR.IND_EXPS, params);
  667.      new = DalibTreeSizeParam (t, new);
  668.  
  669.   }
  670.   {
  671.    return new;
  672.   }
  673.  }
  674.  
  675.   }
  676.   }
  677. # line 530 "Dalib.puma"
  678.   {
  679. # line 531 "Dalib.puma"
  680.    failure_protocol ("Dalib", "DalibRangeParams", t);
  681.   }
  682.    return NoTree;
  683.  
  684. }
  685.  
  686. static tTree DalibRangeParamsFA
  687. # if defined __STDC__ | defined __cplusplus
  688. (register tTree formals, register tTree actuals, register tTree params)
  689. # else
  690. (formals, actuals, params)
  691.  register tTree formals;
  692.  register tTree actuals;
  693.  register tTree params;
  694. # endif
  695. {
  696.   if (formals->Kind == kTYPE_EMPTY) {
  697.   if (actuals->Kind == kBTE_EMPTY) {
  698. # line 537 "Dalib.puma"
  699.    return params;
  700.  
  701.   }
  702.   }
  703.   if (formals->Kind == kTYPE_LIST) {
  704.   if (actuals->Kind == kBTE_LIST) {
  705. # line 541 "Dalib.puma"
  706.  {
  707.   tTree new;
  708.   {
  709. # line 543 "Dalib.puma"
  710.  
  711. # line 545 "Dalib.puma"
  712.  new = DalibRangeParamsFA (formals->TYPE_LIST.Next, actuals->BTE_LIST.Next, params);
  713.       new = DalibRangeParamsA  (actuals->BTE_LIST.Elem, new);
  714.       new = DalibRangeParamsF  (formals->TYPE_LIST.Elem, new);
  715.  
  716.   }
  717.   {
  718.    return new;
  719.   }
  720.  }
  721.  
  722.   }
  723.   }
  724.  yyAbort ("DalibRangeParamsFA");
  725. }
  726.  
  727. static tTree DalibRangeParamsA
  728. # if defined __STDC__ | defined __cplusplus
  729. (register tTree actual, register tTree params)
  730. # else
  731. (actual, params)
  732.  register tTree actual;
  733.  register tTree params;
  734. # endif
  735. {
  736.   if (actual->Kind == kSLICE_EXP) {
  737. # line 554 "Dalib.puma"
  738.    return mBTP_LIST (ExpToVarParam (actual->SLICE_EXP.START), mBTP_LIST (ExpToVarParam (actual->SLICE_EXP.STOP), params));
  739.  
  740.   }
  741. # line 559 "Dalib.puma"
  742.    return mBTP_LIST (ExpToVarParam (actual), mBTP_LIST (ExpToVarParam (actual), params));
  743.  
  744. }
  745.  
  746. static tTree DalibRangeParamsF
  747. # if defined __STDC__ | defined __cplusplus
  748. (register tTree formal, register tTree params)
  749. # else
  750. (formal, params)
  751.  register tTree formal;
  752.  register tTree params;
  753. # endif
  754. {
  755.   if (formal->Kind == kINDEX_TYPE) {
  756. # line 566 "Dalib.puma"
  757.    return mBTP_LIST (ExpToVarParam (MakeSliceExp (formal->INDEX_TYPE.LOWER, formal->INDEX_TYPE.UPPER)), params);
  758.  
  759.   }
  760.   if (formal->Kind == kDYNAMIC) {
  761.   if (formal->DYNAMIC.Shape->Kind == kSLICE_EXP) {
  762. # line 570 "Dalib.puma"
  763.    return mBTP_LIST (ExpToVarParam (MakeSliceExp (formal->DYNAMIC.Shape->SLICE_EXP.START, formal->DYNAMIC.Shape->SLICE_EXP.STOP)), params);
  764.  
  765.   }
  766.   }
  767.  yyAbort ("DalibRangeParamsF");
  768. }
  769.  
  770. tTree DalibFormalSize
  771. # if defined __STDC__ | defined __cplusplus
  772. (register tTree t, register tTree params)
  773. # else
  774. (t, params)
  775.  register tTree t;
  776.  register tTree params;
  777. # endif
  778. {
  779.   if (t->Kind == kUSED_VAR) {
  780. # line 586 "Dalib.puma"
  781.    return DalibFormalSize (ArrayFormals (t->USED_VAR.VARNAME->VAR_OBJ.Object), params);
  782.  
  783.   }
  784.   if (t->Kind == kTYPE_EMPTY) {
  785. # line 590 "Dalib.puma"
  786.    return params;
  787.  
  788.   }
  789.   if (t->Kind == kTYPE_LIST) {
  790.   if (t->TYPE_LIST.Elem->Kind == kINDEX_TYPE) {
  791. # line 594 "Dalib.puma"
  792.    return mBTP_LIST (ExpToVarParam (MakeSliceExp (t->TYPE_LIST.Elem->INDEX_TYPE.LOWER, t->TYPE_LIST.Elem->INDEX_TYPE.UPPER)), DalibFormalSize (t->TYPE_LIST.Next, params));
  793.  
  794.   }
  795.   if (t->TYPE_LIST.Elem->Kind == kDYNAMIC) {
  796.   if (t->TYPE_LIST.Elem->DYNAMIC.Shape->Kind == kSLICE_EXP) {
  797. # line 599 "Dalib.puma"
  798.    return mBTP_LIST (ExpToVarParam (MakeSliceExp (t->TYPE_LIST.Elem->DYNAMIC.Shape->SLICE_EXP.START, t->TYPE_LIST.Elem->DYNAMIC.Shape->SLICE_EXP.STOP)), DalibFormalSize (t->TYPE_LIST.Next, params));
  799.  
  800.   }
  801.   }
  802.   }
  803. # line 604 "Dalib.puma"
  804.   {
  805. # line 605 "Dalib.puma"
  806.    failure_protocol ("Dalib", "DalibFormalSize", t);
  807.   }
  808.    return NoTree;
  809.  
  810. }
  811.  
  812. tTree DalibLocalSize
  813. # if defined __STDC__ | defined __cplusplus
  814. (register tTree t, register tTree params)
  815. # else
  816. (t, params)
  817.  register tTree t;
  818.  register tTree params;
  819. # endif
  820. {
  821.   if (t->Kind == kUSED_VAR) {
  822. # line 622 "Dalib.puma"
  823.    return mBTP_LIST (ExpToVarParam (DalibLocalSizeExp (t->USED_VAR.VARNAME->VAR_OBJ.Ident, ArrayFormals (t->USED_VAR.VARNAME->VAR_OBJ.Object), VarDistribution (t->USED_VAR.VARNAME->VAR_OBJ.Object))), params);
  824.  
  825.   }
  826. # line 629 "Dalib.puma"
  827.   {
  828. # line 630 "Dalib.puma"
  829.    failure_protocol ("Dalib", "DalibLocalSize", t);
  830.   }
  831.    return NoTree;
  832.  
  833. }
  834.  
  835. static tTree DalibLocalSizeExp
  836. # if defined __STDC__ | defined __cplusplus
  837. (register tIdent name, register tTree t, register int dist)
  838. # else
  839. (name, t, dist)
  840.  register tIdent name;
  841.  register tTree t;
  842.  register int dist;
  843. # endif
  844. {
  845.   if (t->Kind == kTYPE_LIST) {
  846.   if (t->TYPE_LIST.Next->Kind == kTYPE_EMPTY) {
  847.   if (equalint (dist, 1)) {
  848. # line 636 "Dalib.puma"
  849.    return MakeSliceExp (mVAR_EXP (MakeUsedVarA (name, "_LOW")), mVAR_EXP (MakeUsedVarA (name, "_HIGH")));
  850.  
  851.   }
  852. # line 641 "Dalib.puma"
  853.    return DalibLocalSizeExp (name, t->TYPE_LIST.Elem, dist);
  854.  
  855.   }
  856. # line 645 "Dalib.puma"
  857.    return mOP_EXP (mOP_TIMES (), DalibLocalSizeExp (name, t->TYPE_LIST.Elem, dist), DalibLocalSizeExp (name, t->TYPE_LIST.Next, dist));
  858.  
  859.   }
  860.   if (t->Kind == kINDEX_TYPE) {
  861. # line 651 "Dalib.puma"
  862.    return MakeSliceExp (t->INDEX_TYPE.LOWER, t->INDEX_TYPE.UPPER);
  863.  
  864.   }
  865.   if (t->Kind == kDYNAMIC) {
  866.   if (t->DYNAMIC.Shape->Kind == kSLICE_EXP) {
  867. # line 655 "Dalib.puma"
  868.    return MakeSliceExp (t->DYNAMIC.Shape->SLICE_EXP.START, t->DYNAMIC.Shape->SLICE_EXP.STOP);
  869.  
  870.   }
  871.   }
  872. # line 659 "Dalib.puma"
  873.   {
  874. # line 660 "Dalib.puma"
  875.    failure_protocol ("Dalib", "DalibLocalSizeExp", t);
  876.   }
  877.    return NoTree;
  878.  
  879. }
  880.  
  881. void BeginDalib ()
  882. {
  883. }
  884.  
  885. void CloseDalib ()
  886. {
  887. }
  888.